package com.mall.mapper;

import com.github.pagehelper.Page;
import com.mall.domain.dto.PaymentPageQueryDTO;
import com.mall.domain.po.Payment;
import com.mall.domain.vo.PaymentVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

/**
 * @description: 支付持久层接口
 * @author 勾新杰
 * @version 1.0
 * @date 2024/11/25 19:45
 */
@Mapper
public interface PaymentMapper {

    /**
     * 新增支付记录
     * @param payment 支付记录
     */
    @Insert("insert into payment (order_id, amount, payment_method, status, create_time, update_time, user_id) " +
            "values (#{orderId}, #{amount}, #{paymentMethod}, #{status}, #{createTime}, #{updateTime}, #{userId});")
    void insert(Payment payment);

    /**
     * 分页查询支付记录
     * @param paymentPageQueryDTO 查询参数
     * @return 支付记录
     */
    Page<PaymentVO> page(PaymentPageQueryDTO paymentPageQueryDTO);
}
